<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>v-on</title>
  <script src="../assets/js/vue.js"></script>
</head>
<body>
  <h1>v-on</h1>
  <hr>
  <div id="app">
    <span>{{ count }}</span>
    <button v-on:click="handleAdd">+</button>
    <button v-on:click="handleSubtract">-</button>
    <br>
    <input type="text" v-on:keyup.enter="handleEnter" v-model="modelData" >
  </div>
  <script>
    var app= new Vue({
      el: '#app',
      data: {
        count: 0,
        modelData: 99
      },
      methods: {
        handleAdd: function() {
          this.count += 1;
        },
        handleSubtract: function() {
          this.count -= 1;
        },
        handleEnter: function() {
          this.count += parseInt(this.modelData);
        }
      }
    })
  </script>
</body>
</html>